
//引入api请求
import {getCategoryListRequest} from '@/api'

const state = {
    categoryList:[],
};
const mutations = {
    SET_CATEGORYLIST_STATE(state,value){
        //因为是异步请求，这里让空数组的值为commit过来的值
        state.categoryList = value
    }
};
const actions = {
    //书写异步请求
   async getCategoryList({commit}){
     const result = await getCategoryListRequest()
     //提交到mutations中
     commit('SET_CATEGORYLIST_STATE',result)
    }
};

const getters = {

};

export default { 
    namespaced:true,
    state, 
    mutations, 
    actions, 
    getters }